import React, {Component} from 'react';
import {Route, RouteComponentProps, Switch} from "react-router";
import {IRouteProps} from "interface/app";
import {withRouter} from "react-router-dom";
import {routes} from "./routes/main";
export interface IMainRouterProps extends RouteComponentProps {
}

export interface IMainRouterState {
    routeList:IRouteProps[]
}


class MainRouter extends Component<IMainRouterProps,IMainRouterState> {
    state={
        routeList:routes
    }
    render() {
        return (
            <Switch>
                {this.state.routeList.map(item => <Route {...item}></Route>)}
            </Switch>
        );
    }
}

export default withRouter(MainRouter);
